Machine Learning with Amazon SageMaker Cookbook by Joshua Arvin Lat

Machine Learning with Amazon SageMaker Cookbook by Joshua Arvin Lat

Author:Joshua Arvin Lat [Joshua Arvin Lat]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2021-10-28T16:00:00+00:00


Figure 4.49 – labeled_df

We have in Figure 4.49 the labeled DataFrame containing the label value of each record.

Use MinMaxScaler from scikit-learn to scale the values in the labeled DataFrame:import pandas as pd

from sklearn.preprocessing import MinMaxScaler

scaler = MinMaxScaler()

scaled_values = scaler.fit_transform(labeled_df.astype(float))

normalized_df = pd.DataFrame(scaled_values)

normalized_df.columns = labeled_df.columns

normalized_df.index = labeled_df.index

normalized_df.head()

This should show the first five elements of normalized_df. This should show a DataFrame similar to what is shown in Figure 4.50:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.